﻿using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Xna.Framework.Graphics;

namespace Daybreak.Core.Rendering
{
    /// <summary>Provides the data and usage information for an index buffer.</summary>
    public class IndexData : IDisposable
    {
        private IndexBuffer _indexBuffer;
        private int _indexCount;
        private int _indexStart;

        public IndexData()
        {
        }

        /// <summary>IndexBuffer to use.</summary>
        public IndexBuffer IndexBuffer
        {
            get { return _indexBuffer; }
            set { _indexBuffer = value; }
        }

        /// <summary>Index in the buffer to start from for render operations.</summary>
        public int IndexStart
        {
            get { return _indexStart; }
            set { _indexStart = value; }
        }

        /// <summary>The number of indexes to use from the buffer.</summary>
        public int IndexCount
        {
            get { return _indexCount; }
            set { _indexCount = value; }
        }


        #region IDisposable Members

        public void Dispose()
        {
            if (_indexBuffer != null)
            {
                _indexBuffer.Dispose();
                _indexBuffer = null;
            }
        }

        #endregion

    }
}
